/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Dao;

import Bean.Historial;
import Dao.AlumnoDao;
import java.sql.*;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author arturo
 */
public class HistorialDao {
    
    public List<Historial> getHistorial(int idAlumno) throws SQLException{
    
            PreparedStatement ps = AlumnoDao.conn.prepareStatement("SELECT * FROM `HISTORY` WHERE alumno=? ");
            ps.setInt(1, idAlumno);
            
            ResultSet rs = ps.executeQuery();
            List<Historial> l = new LinkedList<Historial>();
            
            while(rs.next()){
            
                Historial h = new Historial(rs.getInt("alumno"), rs.getString("Materia"),
                    rs.getInt("Calificacion"), rs.getInt("Creditos"),
                    rs.getString("periodo"), rs.getString("Nins"));
                l.add(h);
            }
    
            return l;
    }
    
         
}
